<div id="sidetabs_body_container">
    <div id="table_area" style="">
        <div id="action_bar" class="action_bar">
            <div id="list_header">
                <h1 id="page_title" class="db place_hide">Danh sách thiết bị</h1>
                <div id="node_show_timespanner" class="place_hide dropdown-subtle-container" style="float: right;">
                    <div class="btn-group subtle">
                        <strong>Tổng số:</strong>
                        <?php echo $sumDevice ?> devices
                    </div>
                </div>
            </div>
        </div>
        <div id="client_table" style="position:relative" class="flex-table add_col">
            <div class="ft_add_col btn-group" style="right: 0px; height: 25px;">
                <div class="btn" data-toggle="dropdown" onclick="window.location='<?php echo site_url().'add-device' ?>'">+</div>
            </div>
            <table class="filter compact fill">
                <thead>
                    <tr class="ft_head">
                        <th style="width:40px" class="ft ftl checkbox nodrag checknum checkbox ftlegend">
                            <input type="checkbox" class="check_all" kl_vkbd_parsed="true">
                        </th>
                        <th class="ft ftc undefined nodrag status ftsortable">
                <table class="lean" style="margin:0 auto">
                    <tbody>
                        <tr style="vertical-align:bottom">
                            <td style="padding:0 5px 0 0"></td>
                            <td class="ftlegend">Status</td>
                            <td style="padding:0 5px 0 0"></td>
                        </tr>
                    </tbody>
                </table>
                </th>
                <th class="ft ftl undefined nodrag description ftsortable">
                <table class="lean">
                    <tbody>
                        <tr style="vertical-align:bottom">
                            <td class="ftlegend">Tên thiết bị</td>
                            <td style="padding:0 5px"></td>
                        </tr>
                    </tbody>
                </table>
                </th>
                <th class="ft ftl  last_seen ftsortable">
                <table class="lean">
                    <tbody>
                        <tr style="vertical-align:bottom">
                            <td class="ftlegend">Nas ID</td>
                            <td style="padding:0 5px"></td>
                        </tr>
                    </tbody>
                </table>
                </th>
                <th class="ft ftl  usage ftsortable">
                    <table class="lean">
                        <tbody>
                            <tr style="vertical-align:bottom">
                                <td class="ftlegend">Địa điểm</td>
                            </tr>
                        </tbody>
                    </table>
                </th>
                <th class="ft ftl  last_seen ftsortable">
                    <table class="lean">
                        <tbody>
                            <tr style="vertical-align:bottom">
                                <td class="ftlegend">Tổng băng thông</td>
                                <td style="padding:0 5px"></td>
                            </tr>
                        </tbody>
                    </table>
                </th>
                <th class="ft ftl  last_seen ftsortable">
                <table class="lean">
                    <tbody>
                        <tr style="vertical-align:bottom">
                            <td class="ftlegend">Tổng người dùng</td>
                            <td style="padding:0 5px"></td>
                        </tr>
                    </tbody>
                </table>
                </th>
                <th class="ft ftl  last_seen ftsortable">
                <table class="lean">
                    <tbody>
                        <tr style="vertical-align:bottom">
                            <td class="ftlegend">Last Online</td>
                            <td style="padding:0 5px"></td>
                        </tr>
                    </tbody>
                </table>
                </th>
                <th class="ft ftl  ip ftsortable">
                <table class="lean">
                    <tbody>
                        <tr style="vertical-align:bottom">
                            <td class="ftlegend">Tác vụ</td>
                            <td style="padding:0 5px"></td>
                        </tr>
                    </tbody>
                </table>
                </th>
                
                </tr>
                </thead>
                <tfoot>
                    <tr class="ft_foot">
                        <td class="ft_foot" colspan="11">
                            <div style="padding: 10px 10px;width: 100%"  id="pagination">
                                <?php echo $this->pagination->create_links();?>
                            </div>
                        </td>
                    </tr>
                </tfoot>
                <tbody>
                    <?php if ($data): ?>
                        <?php $i = 0;
                        foreach ($data AS $el => $le):
                            ?>
                            <tr class="ftp<?php echo $i > 1 ? $i = 0 : $i ?>" data-idx="0" "="" id="item_k76d39b">
                                <td class="ft checkbox nodrag checknum">
                                    <input type="checkbox" class="row_check" kl_vkbd_parsed="true"><?php echo ($el + 1) ?>
                                </td>
                                <td class="ft undefined nodrag ftc">
        <?php echo $fview->ClassOnOff($le->time_update);  ?> 
                                </td>
                                <td class="ft undefined nodrag">
                                    <a class="suppress_click" href="<?php echo site_url() . 'edit-device?id=' . md5($le->did) ?>"><?php echo $le->namedevice ?></a>
                                </td>
                                <td class="ft last_seen"><?php echo $le->nasid ?></td>
                                <td class="ft usage"><?php echo $le->address ?></td>
                                <td class="ft os"><?php echo $fview->formatSizeUnits($le->bw); ?></td>
                                <td class="ft os"><?php echo $le->user; ?></td>
                                <td class="ft os"><?php echo $le->lastonline; ?></td>
                                <td class="ft capabilities" style="padding-right: 0px">
<!--                                    <a href="<?php // echo site_url() . 'edit-device?id=' . md5($le->did) ?>" style="text-decoration: none;">
                                        Sửa
                                    </a> 
                                     |
                                    <a style="cursor: pointer;text-decoration: none;" id="<?php echo md5($le->did); ?>" class="del_item">Xóa</a>
                                     |-->
                                    <a href="<?php echo site_url() . 'device-report?id=' . md5($le->did) ?>" style="text-decoration: none;">Xem thống kê</a>
                                </td>
                            </tr>
                            <?php $i++;
                        endforeach;
                        ?>
<?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<style>
    #pagination{
    }
    #pagination a{
          padding: 5px 10px;
  margin: 10px 2px;
  border: 1px solid #CCC;
  background: #6E6E6E;
  color: #FFF;
    }
    #pagination strong{
          padding: 5px 10px;
  margin: 10px 2px;
  border: 1px solid #CCC;
  background-color: #FFF;
    }
</style>
<script>
    $(document).ready(function ()
    {
        $("#province").on('change', function ()
        {
            var id_province = $(this).val();
            $("#district_select").html('<input type="text" value="Plz, waitting..." class="form-control" name="">');
            $.ajax({
                type: 'get',
                url: '<?php echo site_url('get-district'); ?>',
                data: ({id: id_province}),
                success: function (_data)
                {
                    $("#district_select").html(_data);
                }
            });
        });

        $('.del_item').click(function () {
            var r = confirm("Bạn có chắc chắn xóa thiết bị này không?");
            if (r == true) {
                window.location = '<?php echo site_url() . 'delete-device?id='; ?>' + this.id;
            } else {
                return false;
            }
        });
    })
</script>